package com.lncg;

import com.lncg.config.AppConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 数据转换应用程序主类
 */
@SpringBootApplication
public class DataConverApplication implements CommandLineRunner {

    @Autowired
    private AppConfig appConfig;

    public static void main(String[] args) {
        System.out.println("🚀 启动数据同步应用程序...");
        SpringApplication.run(DataConverApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("🔧 验证应用程序配置...");

        try {
            // 验证配置
            appConfig.validateConfig();

            System.out.println("✅ 应用程序启动完成");

        } catch (Exception e) {
            System.err.println("❌ 应用程序启动失败: " + e.getMessage());
            System.exit(1);
        }
    }
}
